// app.js
App({
	onLaunch() {
		// 获取系统信息
        const systemInfo = wx.getSystemInfoSync();
        const {
            statusBarHeight,
            windowWidth,
            windowHeight,
            model: modelmes
        } = systemInfo;
        // 胶囊按钮位置信息
        const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
        const {
            top,
            height
        } = menuButtonInfo;
        // 导航栏高度 = 状态栏到胶囊的间距（胶囊距上距离-状态栏高度） * 2 + 胶囊高度 + 状态栏高度
        this.globalData.navBarHeight = (top - statusBarHeight) * 2 + height + statusBarHeight;
        this.globalData.menuTop = top;
        this.globalData.menuHeight = height;
        this.globalData.windowWidth = windowWidth;
        this.globalData.windowHeight = windowHeight;

        // 判断iphoneX
        let _this = this;
        this.globalData.iphoneArr = ['iPhone X', 'iPhone XR', 'iPhone XS Max', 'iPhone 11', 'iPhone 11 Pro Max', 'iPhone 12 Mini', 'iPhone 12', 'iPhone 12 Pro', 'iPhone 12 Pro Max']
        this.globalData.iphoneArr.forEach(function (item) {
            if (modelmes.search(item) != -1) {
                _this.globalData.isIphoneX = true
            }
        });
	},
	globalData: {
		iphoneArr: [],
        navBarHeight: 0, // 导航栏高度
        menuTop: 0, // 胶囊距底部间距（保持底部间距一致）
        menuHeight: 0, // 胶囊高度（自定义内容可与胶囊高度保证一致）
        windowHeight: 0,
        windowWidth: 0,
        isIphoneX: false,
	}
})
